﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace Tesla.Web.Pages
{
    public partial class Tesla : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Control control =   LoadControl(VirtualPathUtility.ToAbsolute(@"~/Controls/MasterPageHeader.ascx"));
            Control placeHolderControl = Page.FindControl("HeadControl");
            if (placeHolderControl != null)
            {
                placeHolderControl.Controls.Add(control);
            }
            else
            {
                MasterPage theMaster = Page.Master;
                while (theMaster != null)
                {
                    placeHolderControl = theMaster.FindControl("Head");
                    if (placeHolderControl != null)
                    {
                        placeHolderControl.Controls.Add(control);
                        break;
                    }
                    theMaster = theMaster.Master;
                }
            }
        }
    }
}
